#define _CRT_SECURE_NO_WARNINGS
#include"array.h"


int* masterMind(char* solution, char* guess, int* returnSize) {
    *returnSize = 2;
    int* ans = (int*)calloc(sizeof(int), 2);
    int g_a[26] = { 0 }, s_a[26] = { 0 };

    for (int i = 0; i < 4; i++) {
        if (solution[i] == guess[i]) {
            ans[0] += 1;
        }
        else {
            g_a[guess[i] - 'A']++;
            s_a[solution[i] - 'A']++;
        }
    }

    for (int i = 0; i < 26; i++) {
        ans[1] += g_a[i] > s_a[i] ? s_a[i] : g_a[i];
    }
    return ans;
}